cmake_minimum_required(VERSION 2.6)
project(ainitramfs)

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ainitramfs.template ${CMAKE_CURRENT_BINARY_DIR}/ainitramfs @ONLY)

install(
    FILES ainitramfs.php functions.php init.sh scripts_common.php
    DESTINATION share/ainitramfs
)

install(
    FILES scripts/base.php scripts/nbd-server.php scripts/nbd-server-init.ncd scripts/nbd-server-init.sh
    DESTINATION share/ainitramfs/scripts
)

install(
    FILES getkernelarg.c
    DESTINATION share/ainitramfs
)

install(
    FILES ${CMAKE_CURRENT_BINARY_DIR}/ainitramfs
    DESTINATION bin
    PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
